﻿using System.Text;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using IGMVC.Web.Models;

namespace IGMVC.Web.Views.Issues
{
    public static class HtmlHelperExtensions
    {
        public static string RenderIssuesGridPager(this HtmlHelper helper, IssueListView model)
        {
            StringBuilder markup = new StringBuilder();

            for (int i = 1; i <= model.NumberOfPages; i++)
            {
                markup.Append(helper.ActionLink(i.ToString(), model.ActionName, model.ControllerName, new { pg = i }, null) + " ");
            }

            return markup.ToString();
        }
    }
}
